package com.kk.covert;

import com.kk.pojo.entity.SysUser;
import com.kk.pojo.request.UserRegisterRequest;
import com.kk.pojo.vo.LoginUserVO;
import com.kk.utils.PasswordUtils;
import org.springframework.beans.BeanUtils;

/**
 * @author kl
 * @version 1.0
 * @description: TODO
 * @date 2025/10/14 上午10:59
 */
public class UserCovert {



    public static LoginUserVO UserToVO(SysUser user){
        LoginUserVO vo = new LoginUserVO();
        BeanUtils.copyProperties(user,vo);
        return vo;
    }

    public static SysUser convertRegisterToUser(UserRegisterRequest request){
        SysUser sysUser = new SysUser();
        sysUser.setUsername(request.getUsername());
        // 加密密码
        sysUser.setPassword(request.getPassword());
        sysUser.setEmail(request.getEmail());
        sysUser.setPhone(request.getPhone());
        return sysUser;

    }
}
